/////////////////////////

$(document).ready(function() {
    $(".tablaimportar").collapsiblePanel();
});
   

(function($) {
$.fn.extend({
    collapsiblePanel: function() {
    // Call the ConfigureCollapsiblePanel function for the selected element
    return $(this).each(ConfigureCollapsiblePanel);
}
});
})(jQuery);


function ConfigureCollapsiblePanel() {
$(this).addClass("ui-widget");

// Check if there are any child elements, if not then wrap the inner text within a new div.
if ($(this).children().length == 0) {
$(this).wrapInner("<div></div>");
}    

// Wrap the contents of the container within a new div.
$(this).children().wrapAll("<div class='collapsibleContainerContent ui-widget-content'></div>");

// Create a new div as the first item within the container.  Put the title of the panel in here.
$("<div class='collapsibleContainerTitle ui-widget-header'><div>" + $(this).attr("title") + "</div></div>").prependTo($(this));


// Assign a call to CollapsibleContainerTitleOnClick for the click event of the new title div.
$(".collapsibleContainerTitle", this).click(CollapsibleContainerTitleOnClick);
}


function CollapsibleContainerTitleOnClick() {
// The item clicked is the title div... get this parent (the overall container) and toggle the content within it.
$(".collapsibleContainerContent", $(this).parent()).slideToggle();
}


/////////////////////////




/////////////////////////


function isNumberKey(evt) {
	var charCode = (evt.which) ? evt.which : event.keyCode
			if (charCode > 31 && (charCode < 48 || charCode > 57))
				return false;
         	return true;
}

$(document).ready(function() {
    $('#timepicker_start').timepicker({
        showLeadingZero: false,
        onHourShow: tpStartOnHourShowCallback,
        onMinuteShow: tpStartOnMinuteShowCallback
    });
    $('#timepicker_end').timepicker({
        showLeadingZero: false,
        onHourShow: tpEndOnHourShowCallback,
        onMinuteShow: tpEndOnMinuteShowCallback
    });
});

function tpStartOnHourShowCallback(hour) {
    var tpEndHour = $('#timepicker_end').timepicker('getHour');
    // all valid if no end time selected
    //if ($('#timepicker_end').val() == '') { return true; }
    // Check if proposed hour is prior or equal to selected end time hour
   // if (hour <= tpEndHour) { return true; }
    // if hour did not match, it can not be selected
    return true;
}
function tpStartOnMinuteShowCallback(hour, minute) {
    var tpEndHour = $('#timepicker_end').timepicker('getHour');
    var tpEndMinute = $('#timepicker_end').timepicker('getMinute');
    // all valid if no end time selected
    if ($('#timepicker_end').val() == '') { return true; }
    // Check if proposed hour is prior to selected end time hour
    //if (hour < tpEndHour) { return true; }
    // Check if proposed hour is equal to selected end time hour and minutes is prior
    //if ( (hour == tpEndHour) && (minute < tpEndMinute) ) { return true; }
    // if minute did not match, it can not be selected
    return true;
}

function tpEndOnHourShowCallback(hour) {
    var tpStartHour = $('#timepicker_start').timepicker('getHour');
    // all valid if no start time selected
    if ($('#timepicker_start').val() == '') { return true; }
    // Check if proposed hour is after or equal to selected start time hour
    //if (hour >= tpStartHour) { return true; }
    // if hour did not match, it can not be selected
    return true;
}
function tpEndOnMinuteShowCallback(hour, minute) {
    var tpStartHour = $('#timepicker_start').timepicker('getHour');
    var tpStartMinute = $('#timepicker_start').timepicker('getMinute');
    // all valid if no start time selected
    if ($('#timepicker_start').val() == '') { return true; }
    // Check if proposed hour is after selected start time hour
    //if (hour > tpStartHour) { return true; }
    // Check if proposed hour is equal to selected start time hour and minutes is after
    //if ( (hour == tpStartHour) && (minute > tpStartMinute) ) { return true; }
    // if minute did not match, it can not be selected
    return true;
}

//
function formReset()
{
document.getElementById("f").reset();
}


